package com.xique.door.project.xyl.controller;

import com.xique.common.core.utils.SecurityUtils;
import com.xique.common.core.web.controller.BaseController;
import com.xique.common.core.web.domain.AjaxResult;
import com.xique.door.bean.request.RentStatisticRequest;
import com.xique.door.project.xyl.service.IXylPopulationService;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author shd
 * @create 2021/12/22 13:52
 */
@RestController
@RequestMapping("/xyl/population")
public class XylPopulationController extends BaseController {

    @Autowired
    private IXylPopulationService xylPopulationService;

    @GetMapping("/domicileStatistic")
    @ApiOperation("人员户籍统计")
    public AjaxResult domicileStatistic() {
        return xylPopulationService.domicileStatistic(SecurityUtils.getParkId());
    }

    @GetMapping("/ageStatistic")
    @ApiOperation("人员年龄统计")
    public AjaxResult ageStatistic() {
        return xylPopulationService.ageStatistic(SecurityUtils.getParkId());
    }

    @GetMapping("/tenantStatistic")
    @ApiOperation("租客人数统计")
    public AjaxResult tenantStatistic() {
        return xylPopulationService.tenantStatistic(SecurityUtils.getParkId());
    }

    @GetMapping("/houseStatistic")
    @ApiOperation("房屋出租统计")
    public AjaxResult houseStatistic() {
        return xylPopulationService.houseStatistic(SecurityUtils.getParkId());
    }

    @GetMapping("/rentStatistic")
    @ApiOperation("出租情况")
    public AjaxResult rentStatistic(RentStatisticRequest request) {
        startPage();
        return xylPopulationService.rentStatistic(request);
    }

}
